package com.afei.java.ai.langchain4j.controller;

import com.afei.java.ai.langchain4j.assisant.AFeiAgent;
import com.afei.java.ai.langchain4j.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @Title: AFeiController
 * @Author wangyf
 * @Package com.afei.java.ai.langchain4j.controller
 * @Date 2025/4/24 16:48
 * @description:
 */

@Tag(name = "小小飞")
@RestController
@RequestMapping("/xiaozhi")
public class AFeiController {


    @Autowired
    private AFeiAgent aFeiAgent;


    @PostMapping("/chat")
    @Operation(summary = "对话")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return aFeiAgent.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }
}
